home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWGraphx / Include / FWCPat.h < prev    next >
Encoding:
Text File  |  1995-11-08  |  3.6 KB  |  140 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCPat.h
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWCPAT_H
  11. #define FWCPAT_H
  12.  
  13. #ifndef FWPAT_H
  14. #include "FWPat.h"
  15. #endif
  16.  
  17. // ----- Foundation Includes -----
  18.  
  19. #ifndef FWSTDDEF_H
  20. #include <FWStdDef.h>
  21. #endif
  22.  
  23. #ifndef FWPRIMEM_H
  24. #include <FWPriMem.h>
  25. #endif
  26.  
  27. // ----- Macintosh Includes -----
  28.  
  29. #if defined(FW_BUILD_MAC) && !defined(__QUICKDRAW__)
  30. #include <QuickDraw.h>
  31. #endif
  32.  
  33. // ----- Windows Includes -----
  34.  
  35. #if defined(FW_BUILD_WIN) && !defined(_INC_WINDOWS)
  36. #include <windows.h>
  37. #endif
  38.  
  39. #if FW_LIB_EXPORT_PRAGMAS
  40. #pragma lib_export on
  41. #endif
  42.  
  43. //========================================================================================
  44. //    Forward Class Declarations
  45. //========================================================================================
  46.  
  47. class FW_CLASS_ATTR FW_CReadableStream;
  48. class FW_CLASS_ATTR FW_CWritableStream;
  49. class FW_CLASS_ATTR FW_CColor;
  50.  
  51. //========================================================================================
  52. //    CLASS FW_CColorPatternRep
  53. //========================================================================================
  54.  
  55. class FW_CLASS_ATTR FW_CColorPatternRep : public FW_CPatternRep
  56. {    
  57.     friend class FW_CLASS_ATTR FW_PPattern;
  58.  
  59. public:
  60.     FW_DECLARE_CLASS
  61.  
  62. //----------------------------------------------------------------------------------------
  63. //    Constructors/Destructors
  64. //
  65. protected:
  66.     FW_CColorPatternRep();
  67.     FW_CColorPatternRep(const FW_PixelPattern& pixels, short nbColors, const FW_CColor* colorTable);
  68.     
  69.     FW_CColorPatternRep(FW_PlatformColorPattern platformColorPattern);
  70.  
  71.     FW_CColorPatternRep(FW_CReadableStream& archive);
  72.  
  73.     virtual ~FW_CColorPatternRep();
  74.     
  75. //----------------------------------------------------------------------------------------
  76. //    Inherited API
  77. //
  78. public:    
  79.     virtual FW_Boolean            IsEqual(const FW_CGraphicCountedPtrRep* other) const;
  80.     virtual void                Flatten(FW_CWritableStream& archive) const;
  81.  
  82.     virtual FW_PPattern            Copy() const;
  83.  
  84.     virtual FW_Boolean            IsBlack() const;
  85.     
  86.     virtual void                 Invert();
  87.     
  88.     virtual void                FlipHorizontaly();
  89.     virtual void                FlipVerticaly();
  90.     
  91.     virtual void                ShiftUp();
  92.     virtual void                ShiftDown();
  93.     virtual void                ShiftLeft();
  94.     virtual void                ShiftRight();
  95.             
  96.     static void*                 Read(FW_CReadableStream& archive);
  97.     
  98. private:
  99.     void                        MakePixelPattern(const FW_PixelPattern& pixels, short nbColors, const FW_CColor* colorTable);
  100.  
  101.     void                        GetPixelData(FW_PixelPattern& pixData) const;
  102.     void                        SetPixelData(const FW_PixelPattern& pixData);
  103.     
  104.     unsigned short                GetColorTable(FW_CColor*& colors) const;
  105.     
  106. //----------------------------------------------------------------------------------------
  107. //    Platform Specific
  108. //
  109. public:
  110. #ifdef FW_BUILD_WIN
  111.     virtual HBRUSH                WinCreatePatternBrush() const;
  112.  
  113.     static void                    WinFlipPixelCopy(const void* source, void* dest);
  114. #endif
  115.  
  116. #ifdef FW_BUILD_MAC
  117.     virtual void                MacSetInCurPort() const;    
  118.     static PixPatHandle            MacNewPixPat(const void* pixels, short rowbytes, short pixelSize, 
  119.                                             short withPower, short heightPower,
  120.                                             short nbColors, const FW_CColor* colorTable);
  121. #endif
  122.     
  123. //----------------------------------------------------------------------------------------
  124. //    Data Member
  125. //
  126. private:
  127.     FW_PlatformColorPattern        fPlatformColorPattern;
  128.     
  129. #ifdef FW_BUILD_WIN
  130.     HBITMAP                        fWinCachedBitmap;
  131.     void                        WinForgetCachedBitmap();
  132. #endif
  133. };
  134.  
  135. #if FW_LIB_EXPORT_PRAGMAS
  136. #pragma lib_export off
  137. #endif
  138.  
  139. #endif
  140.